#!/usr/bin/python

import serial
import time
import os
import sys

#Disable Buffered IO
sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)

ser = serial.Serial('/dev/tty.usbserial-A9007M6s',9600,timeout=1)
#print "Serial Port",ser.portstr,"opened..."
while (1 == 1):
	line = ser.readline().rstrip()
	if (line != ""):
			#print line
			if (line.startswith("P1:")):
					print line[-1:]
					#print "1"
			if (line.startswith("P2:")):
					print line[-1:]
					#print "1"
	time.sleep(.1)
ser.close()
